package cn.teduo;

import org.junit.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class dou26 {
    public static void main(String[] args) {
        map();
    }

    public static void map() {
        HashMap<Integer,String> hashMap = new HashMap<>();
        hashMap.put(1,"秋香");
        hashMap.put(9,"唐伯虎");
        hashMap.put(3,"小小书生");
        hashMap.put(100,"四大才子");
        hashMap.put(7,"秋香姐");
        hashMap.put(8,"夺命书生");
//        hashMap.clear();
        Integer a = hashMap.size();
        System.out.println(hashMap);
        System.out.println(a);

        Set<Integer> keys =  hashMap.keySet();
        System.out.println(keys);
        for (Integer k:keys){
           String value = hashMap.get(k);
            System.out.println(value+"---"+k);
        }
           Set<Map.Entry<Integer,String>> entrys = hashMap.entrySet();
        for( Map.Entry<Integer,String>  entry :entrys){
            Integer k = entry.getKey();
            String v = entry.getValue();
            System.out.println(k+"============"+v);
        }


    }
}
